package org.example.string;

import java.util.StringTokenizer;

public class JavaStringSplitEmp2{
    public static void main(String[] args) {
        String str="This is String,spilt by StringTokenizer,created by runoob";
        StringTokenizer st=new StringTokenizer(str);
        System.out.println("-----通过空格分隔-----");
        while(st.hasMoreElements()){
            System.out.println(st.nextElement());
        }
        System.out.println("-----通过逗号分隔-----");
        StringTokenizer str2=new StringTokenizer(str,",");
        while(str2.hasMoreElements()){
            System.out.println(str2.nextElement());
        }
    }
}

